import {h} from "vue";
import {NTag} from "naive-ui";
import { BlackTypeEnum } from "@/api/system/black";

const getTypeDetail = type => {
  if (type === 0) {
    return BlackTypeEnum.IP
  } else if (type === 1) {
    return BlackTypeEnum.USER
  }
}

export const columns = [
  {
    title: '类型',
    key: 'type',
    width: 50,
    align: 'center',
    render(row) {
      return h(
        NTag as any,
        {
          type: 'info',
          round: true,
          size: 'small',
        },
        { default: () => getTypeDetail(row.type)  }
      );
    }
  },
  {
    title: '目标',
    key: 'target',
    width: 100,
    align: 'center',
  },
  {
    title: '原因',
    key: 'reason',
    width: 80,
    align: 'center',
  },
  {
    title: '创建时间',
    key: 'createTime',
    width: 120,
    align: 'center',
  },
  {
    title: '更新时间',
    key: 'updateTime',
    width: 120,
    align: 'center',
  },
];
